export function Setperms(menuUrl,menu){
    let menuItem
    // let menu = JSON.parse(sessionStorage.getItem('menu'))
    const arrfun = (menuUrl,menu)=>{
        for (let index = 0; index < menu.length; index++) {
            if (menu[index].url == menuUrl ) {
                menuItem = menu[index].perms
               return
              }
              if (menu[index].children) {
                arrfun(menuUrl,menu[index].children)
              }
        }
    }
     arrfun(menuUrl,menu)
     return menuItem
    
}
export function Delchildren(arr){
    var arrs = arr
    const arrchildren = (arrs)=>{
        for (let index = 0; index < arrs.length; index++) {
            if (arrs[index].children.length ==0 ) {
                delete arrs[index].children      
              }else if(arrs[index].children.length>0) {
                arrchildren(arrs[index].children)
              }       
        }
    }
    arrchildren(arrs)
     return arrs
    
}
